package com.lord.otter.component.infrastructure.retry.executor;

import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;

/**
 * 请求执行器门面
 *
 * @author lord
 * 2025/8/16 23:22
 */
public interface HttpExecutorFacade {

    /**
     * 执行请求
     *
     * @param url         地址
     * @param httpMethod  请求方式
     * @param httpHeaders 请求头
     * @param requestBody 请求体
     * @author lord
     * 2025/8/16 23:23
     */
    ResponseEntity<String> execute(
            String url,
            HttpMethod httpMethod,
            HttpHeaders httpHeaders,
            String requestBody
    ) throws Exception;

    /**
     * 执行请求
     *
     * @param url          地址
     * @param httpMethod   请求方式
     * @param httpHeaders  请求头
     * @param requestBody  请求体
     * @param responseType 响应类型
     * @author lord
     * 2025/8/16 23:23
     */
    <T> ResponseEntity<T> execute(
            String url,
            HttpMethod httpMethod,
            HttpHeaders httpHeaders,
            String requestBody,
            Class<T> responseType
    ) throws Exception;
}
